<?php 

namespace app\common\shop;

use think\Db;
use think\Model;
use traits\model\SoftDelete;


class UserTeamLevelModel extends model {
    // 完整数据表名
    protected $table = 'user_team_level';
    /**
     * [建表]
     * @return
     */
    public static function createTable(){
        return Db::query("CREATE TABLE If Not Exists `user_team_level` (
              `id` int(11) NOT NULL AUTO_INCREMENT,
              `name` varchar(255) NOT NULL  DEFAULT '0' COMMENT '名称',
              `direct` int(11) NOT NULL  DEFAULT '0' COMMENT '直推人数',
              `team` int(11) NOT NULL DEFAULT '0' COMMENT '团队总人数',
              `selfperformance` decimal(22,2) NOT NULL DEFAULT '0' COMMENT '个人业绩',
              `teamperformance` decimal(22,2) NOT NULL DEFAULT '0' COMMENT '团队业绩',
              `percentage` decimal(22,2) NOT NULL DEFAULT '0' COMMENT '佣金提成',
              `peers` decimal(22,2) DEFAULT NULL DEFAULT '0' COMMENT '平级奖',
              `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
              PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='团长等级表'");
    }
 	/**
     * [添加]
     * @return
    */
    public function add($data){
    	$data['createtime'] = time();
    	return self::insertGetId($data);
    }
}